package net.mihome.app.bean;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.LinkedList;

import com.google.gson.Gson;

import android.R.integer;

import net.mihome.app.bean.net.GsonUtils;
import net.mihome.app.bean.net.ResponsePojo;
import net.mihome.app.common.StringUtils;

/**
 * 接口URL实体类
 * @author liux (http://my.oschina.net/liux)
 * @version 1.0
 * @created 2012-3-21
 */
public class URLs implements Serializable {
	
	public final static String HOST = "121.40.35.78:8080";//192.168.1.213  www.oschina.net
//	public final static String HOST = "210.45.241.195:8181";//192.168.1.213  www.oschina.net
	public final static String HOST2 = "182.92.97.217:7070";//192.168.1.213  www.oschina.net  //短信验证码接口
	public final static String HTTP = "http://";
	public final static String HTTPS = "https://";
	
	private final static String URL_SPLITTER = "/";
	private final static String URL_UNDERLINE = "_";
	public final static String MIHOME_BUGREPORT=HTTP+HOST+URL_SPLITTER+"mihome-manager/manager/bugreport/submit";
	public final static String MIHOME_UPDATE_ANDROID=HTTP+HOST+URL_SPLITTER+"mihome-manager/manager/update/android";
	public final static String MIHOME_UPDATE_ANDROID_QR=HTTP+HOST+URL_SPLITTER+"mihome-manager/manager/update/qcAndroid";
	public final static String MIHOME_COMMUNITY_SNAPSHOT_LIST=HTTP+HOST+URL_SPLITTER+"mihome-manager/manager/community/snapshot/list";
	public final static String MIHOME_COMMUNITY_SNAPSHOT_VIEW=HTTP+HOST+URL_SPLITTER+"mihome-manager/manager/community/snapshot/view";
	/**
	 * 获取新闻资讯接口
	 * */

	public final static String MIHOME_GET_NEWS_LIST=HTTP+HOST+URL_SPLITTER+"mihome-news2/news2/list";
	
	public final static String MIHOME_GET_NEWS_TYPE_LIST=HTTP+HOST+URL_SPLITTER+"mihome-news2/news2/type/list";
	
	public final static String MIHOME_GET_NEWS_DETAIL=HTTP+HOST+URL_SPLITTER+"mihome-news2/news2/get";

    //新闻接口
	public final static String MIHOME_GET_RSSTYPE_LIST=HTTP+HOST+URL_SPLITTER+"mihome-news2/rss/getRssNewsList";
	public final static String MIHOME_GET_RSS_DETAIL=HTTP+HOST+URL_SPLITTER+"mihome-news2/rss/getRssNewsDetail";
    public final static String MIHOME_GET_RSSTYPE_LIST_RADOM=HTTP+HOST+URL_SPLITTER+"mihome-news2/rss/getRssNewsListRadom";
	/**
	 * 大字报接口
	 * */
	public final static String MIHOME_GET_BIGPAPER_LIST=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/list";
	public final static String MIHOME_GET_BIGPAPER_LIST2=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/list2";
	public final static String MIHOME_GET_BIGPAPER_GET_BIGPAPER=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/getBigpaper";
    public final static String MIHOME_GET_BIGPAPER_UNREAD_COUNT=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/getUnRead";
	public final static String MIHOME_GET_BIGPAPER_LIST_COMMENT=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/listComment";
	public final static String MIHOME_GET_BIGPAPER_DELETE=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/delete";
	public final static String MIHOME_GET_BIGPAPER_SUPPORT=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/support/support";

	public final static String MIHOME_GET_BIGPAPER_LIST_MY=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/listMy";

	public final static String MIHOME_GET_BIGPAPER_LIST_HOT=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/listHot";
	public final static String MIHOME_GET_BIGPAPER_DETAIL=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/get";
	public final static String MIHOME_ADD_BIGPAPER=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/save";
    public final static String MIHOME_GET_BIGPAPER_LETTER=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/letter/get";
    public final static String MIHOME_GET_BIGPAPER_CLEAR_ALL=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/letter/setReaded";
    public final static String MIHOME_GET_BIGPAPER_COUNT=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/letter/countUnread";
    public final static String MIHOME_GET_BIGPAPER_LETTER_LIST=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/letter/get";
    public final static String MIHOME_GET_BIGPAPER_LETTER_UPDATE=HTTP+HOST+URL_SPLITTER+"mihome-bigpaper/bigpaper/letter/update";
	/**
     * 用户相关接口
	 * */
	public final static String MIHOME_LOGIN_VALIDATE_HTTP = HTTP + HOST + URL_SPLITTER + "mihome-user/user/login"; 
	public final static String MIHOME_LOGIN_VALIDATE_HTTPS = HTTP + HOST + URL_SPLITTER + "mihome-user/user/login";
	public final static String MIHOME_USER_UPDATE = HTTP + HOST + URL_SPLITTER + "mihome-user/user/update";  
	public final static String MIHOME_USER_RESET_PASSWORD = HTTP + HOST + URL_SPLITTER + "mihome-user/user/resetPasswordByLogin";
	public final static String MIHOME_USER_INFO = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getUserInfo";
	public final static String MIHOME_USER_FRIEND_INFO = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getFriendInfo";
	public final static String MIHOME_USER_GET_COMMUNITY_ADMIN = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getCommunityAdmin";
    //获取带备注的好友信息
	public final static String MIHOME_USER_FRIEND_INFO_MARK = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getFriendInfoWithMark";
	public final static String MIHOME_USER_FRIEND_INFO_BY_NAME = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getFriendInfoByName";
	public final static String MIHOME_USER_BACKGROUND_IMG = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getBgImg";
	public final static String MIHOME_USER_HEAD_BY_NAME = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getHeadByName";

	public final static String MIHOME_USER_PROPERTIE_SET = HTTP + HOST + URL_SPLITTER + "mihome-user/user/propertie/set";
	public final static String MIHOME_USER_PROPERTIE_GET = HTTP + HOST + URL_SPLITTER + "mihome-user/user/propertie/get";
	//重置密码
	public final static String MIHOME_USER_REST_PASSWORD = HTTP + HOST + URL_SPLITTER + "mihome-user/user/resetPassword";
	//根据用户名取出手机号
	public final static String MIHOME_USER_GET_PHONE_BY_USERNAME = HTTP + HOST + URL_SPLITTER + "mihome-user/user/getPhoneByUsername";
	/**
	 * 图片上传接口
	 * */
	public final static String MIHOME_IMAGE_UPLOAD=HTTP+HOST+URL_SPLITTER+"mihome-image/image/save";
	/**
	 * 报修有关接口
	 * */
	public final static String MIHOME_GET_REPAIR_LIST=HTTP+HOST+URL_SPLITTER+"mihome-wuye/repair/require/list";
	public final static String MIHOME_GET_REPAIR_ADD=HTTP+HOST+URL_SPLITTER+"mihome-wuye/repair/require/add";

	public final static String MIHOME_GET_REPAIR_DETAIL=HTTP+HOST+URL_SPLITTER+"mihome-wuye/repair/require/getRepairRequire";
	/**
	 * 广告接口
	 * */
	public final static String MIHOME_GET_ADVERT_LIST=HTTP+HOST+URL_SPLITTER+"mihome-biz/advert/listByGps";
	public final static String MIHOME_GET_SHOP_DETAIL=HTTP+HOST+URL_SPLITTER+"mihome-biz/shop/getShopDetail";
	public final static String MIHOME_GET_SHOP_LIST=HTTP+HOST+URL_SPLITTER+"mihome-biz/shop/getShopList";
	public final static String MIHOME_GET_SHOP_MENU=HTTP+HOST+URL_SPLITTER+"mihome-biz/shop/getShopMenus";
	public final static String MIHOME_GET_GOODS=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/list";
	public final static String MIHOME_GET_GOODS_DETAIL=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/get";
	public final static String MIHOME_GET_GOODS_MAKE_ORDER=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/order/makeOrder";
	public final static String MIHOME_GET_GOODS_BUYCAR_ADD=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/buycar/add";
	public final static String MIHOME_GET_GOODS_BUYCAR_RESET_NUM=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/buycar/resetNum";
	public final static String MIHOME_GET_GOODS_BUYCAR_COUNT=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/buycar/count";
	public final static String MIHOME_GET_GOODS_BUYCAR_LIST=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/buycar/list";


    public final static String MIHOME_GET_SHOP_SUPPORT=HTTP+HOST+URL_SPLITTER+"mihome-biz/shop/support/support";
    public final static String MIHOME_GET_SHOP_TRAMPLE=HTTP+HOST+URL_SPLITTER+"mihome-biz/shop/support/trample";
    public final static String MIHOME_GET_SHOP_CALL_COUNT=HTTP+HOST+URL_SPLITTER+"mihome-biz/shop/support/callCount";

	public final static String MIHOME_GET_GOODS_LIKE=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/support/support";
	public final static String MIHOME_GET_GOODS_TRAMPLE=HTTP+HOST+URL_SPLITTER+"mihome-biz/goods/support/trample";
	/**
	 * 短信验证码接口http://182.92.97.217:7070/mihome-message/message/sms?mobile=18500774289
	 * */
	public final static String MIHOME_SEND_PHONE_SEND_CODE=HTTP+HOST+URL_SPLITTER+"mihome-user/user/verify_code/sms";
	public final static String MIHOME_SEND_PHONE_SEND_CODE_EXISTS=HTTP+HOST+URL_SPLITTER+"mihome-user/user/verify_code/sms_exists";
	public final static String MIHOME_SEND_PHONE_CHECK=HTTP+HOST+URL_SPLITTER+"mihome-user/user/verify_code/checkSms";
	/**
	 * 获取小区和楼栋的接口
	 * */
	public final static String MIHOME_GET_COMMINUTY_LIST=HTTP+HOST+URL_SPLITTER+"mihome-user/area/fetch";
	public final static String MIHOME_GET_COMMINUTY_SEARCH=HTTP+HOST+URL_SPLITTER+"mihome-user/area/search";
	public final static String MIHOME_GET_COMMINUTY_GETBUILDING=HTTP+HOST+URL_SPLITTER+"mihome-user/area/getBuilding";
	public final static String MIHOME_GET_COMMINUTY_UPDATE=HTTP+HOST+URL_SPLITTER+"mihome-user/user/updateCommunity";
	/**
	 * 注册有关接口
	 * */
	public final static String MIHOME_REGISTER_CHECK_USERNAME=HTTP+HOST+URL_SPLITTER+"mihome-user/user/checkUsername";
	public final static String MIHOME_REGISTER=HTTP+HOST+URL_SPLITTER+"mihome-user/user/regesit";

	/**
	 * 聊天有关接口
	 * */
	public final static String MIHOME_CHAT_ROOM_LIST=HTTP+HOST+URL_SPLITTER+"mihome-talk/room/list";
	public final static String MIHOME_CHAT_ROOM_LIST_MY=HTTP+HOST+URL_SPLITTER+"mihome-talk/room/listMy";
	public final static String MIHOME_CHAT_ROOM_ADD=HTTP+HOST+URL_SPLITTER+"mihome-talk/room/add";
	public final static String MIHOME_CHAT_TALK_TALK_ADD=HTTP+HOST+URL_SPLITTER+"mihome-talk/talk/talk";
	public final static String MIHOME_CHAT_TALK_TALK_LIST=HTTP+HOST+URL_SPLITTER+"mihome-talk/talk/listRecord";
	public final static String MIHOME_CHAT_ROOM_JOINROOM=HTTP+HOST+URL_SPLITTER+"mihome-talk/room/joinRoom";
	public final static String MIHOME_CHAT_ROOM_LEAVELROOM=HTTP+HOST+URL_SPLITTER+"mihome-talk/room/leaveloom";
	public final static String MIHOME_CHAT_ROOM_DELROOM=HTTP+HOST+URL_SPLITTER+"mihome-talk/room/delRoom";

    //
    //环信聊天接口
    //获取好友
    public final static String MIHOME_USER_CHAT_LIST_FRIENDS=HTTP+HOST+URL_SPLITTER+"mihome-user/chat/getFriendsByOpenId";
    //搜索好友
    public final static String MIHOME_USER_CHAT_SEARCH_FRIENDS=HTTP+HOST+URL_SPLITTER+"mihome-user/chat/searchUser";
    public final static String MIHOME_USER_CHAT_GET_USER_BY_OPENID=HTTP+HOST+URL_SPLITTER+"mihome-user/chat/getUserByOpenId";
    public final static String MIHOME_USER_CHAT_GET_GROUP_MEMBERS=HTTP+HOST+URL_SPLITTER+"mihome-user/chat/getGroupsByGroupId";
    public final static String MIHOME_USER_CHAT_SAVE_MARK=HTTP+HOST+URL_SPLITTER+"mihome-user/user/saveUserMark";
    public final static String MIHOME_USER_CHAT_GET_GROUP_LIST=HTTP+HOST+URL_SPLITTER+"mihome-user/chat/getGroupByUid"; //参数为：want_uid
    //获取群组头像接口  地址为图像地址+ group_群号
    public final static String MIHOME_GROUP_AVATAR=HTTP+HOST+URL_SPLITTER+"images/group_";
    public final static String MIHOME_GROUP_AVATAR_UPLOAD=HTTP+HOST+URL_SPLITTER+"mihome-image/image/group/save";
	/**
	 * 文章接口
	 * */
	public final static String MIHOME_ARTICLE_LIST=HTTP+HOST+URL_SPLITTER+"mihome-news2/article/select";
	public final static String MIHOME_ARTICLE_DETAIL=HTTP+HOST+URL_SPLITTER+"mihome-news2/article/get";
	
	/**
	 * 一下是开源中国的接口
	 * */
	private final static String URL_API_HOST = HTTP + HOST + URL_SPLITTER;
	public final static String LOGIN_VALIDATE_HTTP = HTTP + HOST + URL_SPLITTER + "action/api/login_validate";
	public final static String LOGIN_VALIDATE_HTTPS = HTTPS + HOST + URL_SPLITTER + "action/api/login_validate";
	public final static String NEWS_LIST = URL_API_HOST+"action/api/news_list";
	public final static String NEWS_DETAIL = URL_API_HOST+"action/api/news_detail";
	public final static String POST_LIST = URL_API_HOST+"action/api/post_list";
	public final static String POST_DETAIL = URL_API_HOST+"action/api/post_detail";
	public final static String POST_PUB = URL_API_HOST+"action/api/post_pub";
	public final static String TWEET_LIST = URL_API_HOST+"action/api/tweet_list";
	public final static String TWEET_DETAIL = URL_API_HOST+"action/api/tweet_detail";
	public final static String TWEET_PUB = URL_API_HOST+"action/api/tweet_pub";
	public final static String TWEET_DELETE = URL_API_HOST+"action/api/tweet_delete";
	public final static String ACTIVE_LIST = URL_API_HOST+"action/api/active_list";
	public final static String MESSAGE_LIST = URL_API_HOST+"action/api/message_list";
	public final static String MESSAGE_DELETE = URL_API_HOST+"action/api/message_delete";
	public final static String MESSAGE_PUB = URL_API_HOST+"action/api/message_pub";
	public final static String COMMENT_LIST = URL_API_HOST+"action/api/comment_list";
	public final static String COMMENT_PUB = URL_API_HOST+"action/api/comment_pub";
	public final static String COMMENT_REPLY = URL_API_HOST+"action/api/comment_reply";
	public final static String COMMENT_DELETE = URL_API_HOST+"action/api/comment_delete";
	public final static String SOFTWARECATALOG_LIST = URL_API_HOST+"action/api/softwarecatalog_list";
	public final static String SOFTWARETAG_LIST = URL_API_HOST+"action/api/softwaretag_list";
	public final static String SOFTWARE_LIST = URL_API_HOST+"action/api/software_list";
	public final static String SOFTWARE_DETAIL = URL_API_HOST+"action/api/software_detail";	
	public final static String USERBLOG_LIST = URL_API_HOST+"action/api/userblog_list";
	public final static String USERBLOG_DELETE = URL_API_HOST+"action/api/userblog_delete";
	public final static String BLOG_LIST = URL_API_HOST+"action/api/blog_list";
	public final static String BLOG_DETAIL = URL_API_HOST+"action/api/blog_detail";
	public final static String BLOGCOMMENT_LIST = URL_API_HOST+"action/api/blogcomment_list";
	public final static String BLOGCOMMENT_PUB = URL_API_HOST+"action/api/blogcomment_pub";
	public final static String BLOGCOMMENT_DELETE = URL_API_HOST+"action/api/blogcomment_delete";
	public final static String MY_INFORMATION = URL_API_HOST+"action/api/my_information";
	public final static String USER_INFORMATION = URL_API_HOST+"action/api/user_information";
	public final static String USER_UPDATERELATION = URL_API_HOST+"action/api/user_updaterelation";
	public final static String USER_NOTICE = URL_API_HOST+"action/api/user_notice";
	public final static String NOTICE_CLEAR = URL_API_HOST+"action/api/notice_clear";
	public final static String FRIENDS_LIST = URL_API_HOST+"action/api/friends_list";
	public final static String FAVORITE_LIST = URL_API_HOST+"action/api/favorite_list";
	public final static String FAVORITE_ADD = URL_API_HOST+"action/api/favorite_add";
	public final static String FAVORITE_DELETE = URL_API_HOST+"action/api/favorite_delete";
	public final static String SEARCH_LIST = URL_API_HOST+"action/api/search_list";
	public final static String PORTRAIT_UPDATE = URL_API_HOST+"action/api/portrait_update";
	public final static String UPDATE_VERSION = URL_API_HOST+"MobileAppVersion.xml";
	public final static String REPORT = URL_API_HOST + "action/communityManage/report";
	
	private final static String URL_HOST = "oschina.net";
	private final static String URL_WWW_HOST = "www."+URL_HOST;
	private final static String URL_MY_HOST = "my."+URL_HOST;
	
	private final static String URL_TYPE_NEWS = URL_WWW_HOST + URL_SPLITTER + "news" + URL_SPLITTER;
	private final static String URL_TYPE_SOFTWARE = URL_WWW_HOST + URL_SPLITTER + "p" + URL_SPLITTER;
	private final static String URL_TYPE_QUESTION = URL_WWW_HOST + URL_SPLITTER + "question" + URL_SPLITTER;
	private final static String URL_TYPE_BLOG = URL_SPLITTER + "blog" + URL_SPLITTER;
	private final static String URL_TYPE_TWEET = URL_SPLITTER + "tweet" + URL_SPLITTER;
	private final static String URL_TYPE_ZONE = URL_MY_HOST + URL_SPLITTER + "u" + URL_SPLITTER;
	private final static String URL_TYPE_QUESTION_TAG = URL_TYPE_QUESTION + "tag" + URL_SPLITTER;
	
	public final static int URL_OBJ_TYPE_OTHER = 0x000;
	public final static int URL_OBJ_TYPE_NEWS = 0x001;
	public final static int URL_OBJ_TYPE_SOFTWARE = 0x002;
	public final static int URL_OBJ_TYPE_QUESTION = 0x003;
	public final static int URL_OBJ_TYPE_ZONE = 0x004;
	public final static int URL_OBJ_TYPE_BLOG = 0x005;
	public final static int URL_OBJ_TYPE_TWEET = 0x006;
	public final static int URL_OBJ_TYPE_QUESTION_TAG = 0x007;
	
	private int objId;
	private String objKey = "";
	private int objType;
	
	public int getObjId() {
		return objId;
	}
	public void setObjId(int objId) {
		this.objId = objId;
	}
	public String getObjKey() {
		return objKey;
	}
	public void setObjKey(String objKey) {
		this.objKey = objKey;
	}
	public int getObjType() {
		return objType;
	}
	public void setObjType(int objType) {
		this.objType = objType;
	}
	
	/**
	 * 转化URL为URLs实体
	 * @param path
	 * @return 不能转化的链接返回null
	 */
	public final static URLs parseURL(String path) {
		if(StringUtils.isEmpty(path))return null;
		path = formatURL(path);
		URLs urls = null;
		String objId = "";
		try {
			URL url = new URL(path);
			//站内链接
			if(url.getHost().contains(URL_HOST)){
				urls = new URLs();
				//www
				if(path.contains(URL_WWW_HOST )){
					//新闻  www.oschina.net/news/27259/mobile-internet-market-is-small
					if(path.contains(URL_TYPE_NEWS)){
						objId = parseObjId(path, URL_TYPE_NEWS);
						urls.setObjId(StringUtils.toInt(objId));
						urls.setObjType(URL_OBJ_TYPE_NEWS);
					}
					//软件  www.oschina.net/p/jx
					else if(path.contains(URL_TYPE_SOFTWARE)){
						urls.setObjKey(parseObjKey(path, URL_TYPE_SOFTWARE));
						urls.setObjType(URL_OBJ_TYPE_SOFTWARE);
					}
					//问答
					else if(path.contains(URL_TYPE_QUESTION)){
						//问答-标签  http://www.oschina.net/question/tag/python
						if(path.contains(URL_TYPE_QUESTION_TAG)){
							urls.setObjKey(parseObjKey(path, URL_TYPE_QUESTION_TAG));
							urls.setObjType(URL_OBJ_TYPE_QUESTION_TAG);
						}
						//问答  www.oschina.net/question/12_45738
						else{
							objId = parseObjId(path, URL_TYPE_QUESTION);
							String[] _tmp = objId.split(URL_UNDERLINE);
							urls.setObjId(StringUtils.toInt(_tmp[1]));
							urls.setObjType(URL_OBJ_TYPE_QUESTION);
						}
					}
					//other
					else{
						urls.setObjKey(path);
						urls.setObjType(URL_OBJ_TYPE_OTHER);
					}
				}
				//my
				else if(path.contains(URL_MY_HOST)){					
					//博客  my.oschina.net/szpengvictor/blog/50879
					if(path.contains(URL_TYPE_BLOG)){
						objId = parseObjId(path, URL_TYPE_BLOG);
						urls.setObjId(StringUtils.toInt(objId));
						urls.setObjType(URL_OBJ_TYPE_BLOG);
					}
					//动弹  my.oschina.net/dong706/tweet/612947
					else if(path.contains(URL_TYPE_TWEET)){
						objId = parseObjId(path, URL_TYPE_TWEET);
						urls.setObjId(StringUtils.toInt(objId));
						urls.setObjType(URL_OBJ_TYPE_TWEET);
					}
					//个人专页  my.oschina.net/u/12
					else if(path.contains(URL_TYPE_ZONE)){
						objId = parseObjId(path, URL_TYPE_ZONE);
						urls.setObjId(StringUtils.toInt(objId));
						urls.setObjType(URL_OBJ_TYPE_ZONE);
					}
					else{
						//另一种个人专页  my.oschina.net/dong706
						int p = path.indexOf(URL_MY_HOST+URL_SPLITTER) + (URL_MY_HOST+URL_SPLITTER).length();
						String str = path.substring(p);
						if(!str.contains(URL_SPLITTER)){
							urls.setObjKey(str);
							urls.setObjType(URL_OBJ_TYPE_ZONE);
						}
						//other
						else{
							urls.setObjKey(path);
							urls.setObjType(URL_OBJ_TYPE_OTHER);
						}
					}
				}
				//other
				else{
					urls.setObjKey(path);
					urls.setObjType(URL_OBJ_TYPE_OTHER);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			urls = null;
		}
		return urls;
	}

	/**
	 * 解析url获得objId
	 * @param path
	 * @param url_type
	 * @return
	 */
	private final static String parseObjId(String path, String url_type){
		String objId = "";
		int p = 0;
		String str = "";
		String[] tmp = null;
		p = path.indexOf(url_type) + url_type.length();
		str = path.substring(p);
		if(str.contains(URL_SPLITTER)){
			tmp = str.split(URL_SPLITTER);
			objId = tmp[0];
		}else{
			objId = str;
		}
		return objId;
	}
	
	/**
	 * 解析url获得objKey
	 * @param path
	 * @param url_type
	 * @return
	 */
	private final static String parseObjKey(String path, String url_type){
		path = URLDecoder.decode(path);
		String objKey = "";
		int p = 0;
		String str = "";
		String[] tmp = null;
		p = path.indexOf(url_type) + url_type.length();
		str = path.substring(p);
		if(str.contains("?")){
			tmp = str.split("?");
			objKey = tmp[0];
		}else{
			objKey = str;
		}
		return objKey;
	}
	
	/**
	 * 对URL进行格式处理
	 * @param path
	 * @return
	 */
	private final static String formatURL(String path) {
		if(path.startsWith("http://") || path.startsWith("https://"))
			return path;
		return "http://" + URLEncoder.encode(path);
	}	
	/**
	 * 将输入流转换成字符串
	 * */
	public static String readFromInputStream(InputStream is) throws Exception{
		BufferedReader bufferedReader=null;
		try{
			bufferedReader=new BufferedReader(new InputStreamReader(is,"utf-8"));
			StringBuffer sb = new StringBuffer();    
			String line;
			while((line=bufferedReader.readLine())!=null){
				sb.append(line);
			}
			bufferedReader.close();
			return sb.toString();
		}catch(Exception e){
			throw e;
		}finally{
			if(bufferedReader!=null){
				bufferedReader.close();
				is.close();
			}
		}
	}
	/**
	 * 将输入流转换成ResponsePojo对象
	 * */
	public static ResponsePojo fromInputstream(InputStream is) throws Exception{
		String iString=readFromInputStream(is);
		return new GsonUtils<LinkedList>().fromJson(iString);
	}
}
